# Amazon Web Services Notes
General notes from working with the AWS.
# Enabling Programmatic Access with MFA
Use MFA with Programmatic Access
- Run code below to get temporary authenticated credentials
aws sts get-session-token --serial-number <arn::iam> --token-code <token from MFA device>
Return
{
"Credentials": {
"AccessKeyId": "ASIAQ4IGLDPUD7RPZS7C",
"SecretAccessKey": "fO3mKHQTSzDC9L82KbkL3k/KQoeUw/lBuBJgnuR6",
"SessionToken": "FwoGZXIvYXdzELL//////////wEaDJkfKguXzUQGWPouLyKGAZ0j66m0/Y7uadkV5qXlfoFnahdRV5uz/mRlyLzKm0dU66DvT/uVDl6vC7ZmqrubzuljuPX4d8lC2vaZt4ySTjDKNMzM4jwggc/49UVRtaU3siYzF9uDghJeaZ4O3hjyYWxE3e2oWs2xTQPMPo75/xmC5nnUoPOc3Lg48fjexUEUIzGZ6U5uKNSRnIAGMijsX/yOYdimDJRa2PR+75ryEUegcNursvkkWkMzPblVmjdiWk+n+0st",
"Expiration": "2021-01-20T04:29:08+00:00"
}
}
- go to your
.aws
folder and open.credentials
Create a new named user profile using the credentials from the previous step.
TIP
No double quotes are needed.
[mfa]
aws_access_key_id = <Access-key-id>
aws_secret_access_key = <secret-key>
aws_session_token = <session-token>
# Deleting a MFA Device
- Find the device using
TIP
If you get an authentication error, create temporary credentials using the Enabling Programmatic Access with MFA steps.
aws iam list-virtual-mfa-devices --profile mfa
- Get the serial number of the arn device
aws iam delete-virtual-mfa-device --serial-number <arn::mfa device> --profile mfa
# CloudFront
# Connect Cloudfront to S3 Bucket
# Prerequisites
domain purchased with nameservers pointed to AWS ( can use Route53 )
# References
Elaborated based on this AWS tutorial
# Tutorial
- Create a hosted zone under Route 53 for your given domain
- Example would be for scout.build (base domain) to create a zone named scout.build
- Create s3 bucket following DNS standards with no periods (.). You can still link the bucket to cloudfront without have the name match.
- Example is hawaii.scout.build would have a s3 bucket named hawaii.scout.build
- Request a certificate from the certificate manager on AWS, must request on N.Virginia Region!!
- Add the domain name and subdomain for the cert, such as hawaii.scout.build
- Validate using DNS Search
- Add a tag with name of the subdomain
- Click on make a
CNAME
record in Route 53 - This automatically creates the
CNAME
record in Route 53 - Once the certificate and s3 bucket are setup create a cloudfront instance following the tutorial above.
Important notes to remember when setting up the Cloudfront Distribution.
- Origin Domain Name - s3 bucket
- redirect http to https
- create new access identity
- Alternate Domain Names - exact name of s3 bucket ( same as cert too! )
- Default Root Object - index.html
- Comment - domain name
# S3 Transferring data Between Two Accounts
Transferring data between two AWS accounts
# Elastic Load Balancers
How Elastic Load Balancing works
# Getting Started
create EC2 Targets ( where the traffic will be going )
- can create in two availability zones, but don't have to. However AWS requires two be specified for the ELB.
- create a security group for the elb-instances with port 80/443 open for now.
- If internal facing, will only be open to ELB at a later point.
Create a new Security Group
Examine imported TLS certificates in AWS Certificate Manager
Create an AWS Elastic Load Balancer (ELB)
Create Target Group for ELB
Specify a Target for user within a Target Group
Edit ELB to use Target Group
Update EC2 Security Group to alias an open permission group
Optional alias the load balancer on Route 53
# Rhino Compute
- Create Windows Basic EC2 Instance
- assign Name
- Security group
- ensure that port 3389/RDP is open to an IP you have control of
- Download SSH pair
- Login to Windows Machine using RDP
- can get Password from EC2 Dashboard by clicking on
connect
- use the SSH .pem file to get password
- can get Password from EC2 Dashboard by clicking on
- Enable auto login running
run
netplwiz
- enter Administrator credentials and uncheck the box
KPFui-Rhino-Compute-Windows-Server-1 Administrator ?HJyYMRytvLJ7=pzm4hEE9=Q@QxdcEr8
KPFui-Rhino-Compute-Windows-Server-2 Administrator 2j.e=LUL44f6epdNIQ(c?LFCEbC?t-H?
APIKEY = 5DAjRb%z7y$LPsU60cn01
iBpt3vOfkSe2iJK?(2$e=u!9yVH*4v88
RHINO COMPUTE KEY ec2-44-192-114-124.compute-1.amazonaws.com Administrator -jV3%?DlqAtgMpNKsifdSKA?dEYCkZ3b